import { createMemoryHistory, createRouter } from 'vue-router'
import Login from '../view/Login.vue'
import Chat from '../view/Chat.vue'
import Register from '../view/Register.vue'
import Mainpage from '../view/Mainpage.vue'
import Buy from '../view/Buy.vue'
import Cart from '../view/Cart.vue'
import successBuy from '../view/successBuy.vue'
import Orders from '../view/Orders.vue'
import Reviews from '../view/Reviews.vue'
import UploadForm from '../view/UploadForm.vue';
import ManageForm from '../view/ManageForm.vue';
import UserPage from '../view/UserPage.vue'; 
import AdminPage from '../view/AdminPage.vue';
import AdminManage from '../view/AdminManage.vue';
import NoticeManage from '../view/NoticeManage.vue';
import LookMes from '../view/LookMes.vue'
import ProductRanking from '../view/ProductRanking.vue'
import UserManage from '../view/UserManage.vue'
import LogManage from '../view/LogManage.vue'
import  Ordermanagement from '../view/Ordermanagement.vue'
const routes = [
  { path: '/', component: Login },
  { path: '/chat', component: Chat },
  { path: '/register', component: Register },
  { path: '/mainpage', component: Mainpage },
  { path: '/buy/:id', name:'buy', component: Buy,
    
    props: true
  },
  { path: '/cart', name: 'cart', component: Cart ,
    props: true},
  
    {
      path:'/successBuy',name:'successBuy',component:successBuy,
    },
    
    { path: '/userPage', component: UserPage },
  {
    path: '/userPage',
    component: UserPage,
    children: [
      { path: '/upload', component: UploadForm },
      { path: '/manage', component: ManageForm },
      { path: '/order/orders', component: Orders },
      { path: '/order/reviews', component: Reviews },
      { path: '/chat', component: Chat },
    ]
  },
  { path: '/admin', component: AdminPage },
  {
    path: '/admin',
    component: AdminPage,
    children: [
      { path: '/adminManage', component:AdminManage },
      { path: '/noticeManage', component:NoticeManage },
      {path:'/lookMes',component:LookMes},
      {path:'/productRanking',component:ProductRanking},
      {path: '/logManage',component: LogManage},
      { path: '/ordermanagement', component: Ordermanagement },
      { path: '/usermanage', component: UserManage },
    ]
  },
  
]



const router = createRouter({
  history: createMemoryHistory(),
  routes, 
})
export default router;